package com.dems.core.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by zhangzhile on 2016/12/20.
 * 业务工厂
 */
@Service
public class FactoryService {

    @Autowired
    private DataFactory dataFactory;

    /**
     * 定义TradeNo的生成
     *
     * @return
     */
    public String createTradeNo() {
        return dataFactory.getUID(LoanassistConstants.BANKAPI_BANK_TRADENO);
    }

    /**
     * 定义reqNo的生成
     *
     * @return
     */
    public String createReqNo() {
        return dataFactory.getUID(LoanassistConstants.BANKAPI_BANK_REQNO);
    }


    public String createIdByObj(Class clz) {
        return dataFactory.getUID("cls-" + clz.getName());
    }

    /**
     * 定义TradeNo的生成
     *
     * @return
     */
    public String createPayOrderFtp() {
        return dataFactory.getUID(LoanassistConstants.BANKAPI_BANK_B_PAY_ORDER_FTP);
    }

    /**
     * 定义imageId 17位长度
     *
     * @return
     */
    public String creditImageId() {
        return dataFactory.getUIDByLen1(LoanassistConstants.PSBC_BANKAPI_BANK_IMAGEID, 17);
    }

    /**
     * 生成默认16随机数
     *
     * @return
     */
    public String creditKey() {
        return dataFactory.getUIDByLen1(LoanassistConstants.BANKAPI_BANK_KEY, 16);
    }

    /**
     * 生成批次号
     *
     * @return
     */
    public String createBatchNo() {
        return dataFactory.getUID(LoanassistConstants.BANKAPI_BANK_BATCHNOO);
    }

    /**
     * 生成坐席工号
     * */
    public String createWorkNo(){
        return dataFactory.getUID(LoanassistConstants.WORK_BATCHNO);
    }
}
